<template>
  <div>
    <div class="button-list">
      <el-button type="primary" size="small" v-on:click="getMonitor()">刷新</el-button>
    </div>
    <div class="table-content">
      <el-table :data="monitorData" highlight-current-row v-loading="listLoading" @selection-change="selsChange" style="width: 100%;">
      <el-table-column
        type="selection"
        width="55">
      </el-table-column>
      <el-table-column prop="name" label="任务名称" width="120"></el-table-column>
      <el-table-column prop="type_spider" label="爬虫类型" width="120"></el-table-column>
      <el-table-column prop="type_template" label="模版类型"></el-table-column>
      <el-table-column prop="type_business" label="业务类型"></el-table-column>
      <el-table-column prop="jid" label="任务id"></el-table-column>
        <el-table-column prop="status" label="状态"></el-table-column>
      <el-table-column prop="startTime" label="开始时间"></el-table-column>
      <el-table-column prop="endTime" label="结束时间"></el-table-column>
    </el-table>
    </div>
  </div>
</template>

<script>
  import {checkTasks} from '../apis/api'
  export default {
    data () {
      return {
        monitorData: [],
        multipleSelection: [],
        sels: [],
        listLoading: false,
        endpointSP: this.$store.state.endpointSP
        // endpointDB: this.$store.state.endpointDB
      }
    },
    methods: {
      getMonitor () {
        let _this = this
        _this.listLoading = true
        checkTasks().then(res => {
          let results = res.data
          _this.monitorData = results
          _this.listLoading = false
        }, res => {
          _this.$message({
            message: '出错了，请联系管理员',
            type: 'error'
          })
        })
      },
      selsChange: function (sels) {
        this.sels = sels
      }
    },
    mounted () {
      this.getMonitor()
    }
  }
</script>

<style scoped>
  .button-list {
    margin-bottom: 10px;
  }
</style>
